import request from './base'

let login = ()=>{}
if (process.env.NODE_ENV === 'production') {
  /**
   * 企业微信登录接口
   * @param code
   * @returns {Promise<T>}
   */
  login = (code) => {
    return request({
      method: 'get',
      url: `api/member/api-member/member/QWLogin`,
      data: {code}
    }).then(res => res)
  }

} else {
  /**
   * 本地测试登录接口
   * @param code
   * @returns {Promise<T>}
   */
 login = (code) => {
    return request({
      method: 'get',
      url: `api/member/api-member/member/login`,
      data: {code:'zf=66J4nVJaFag=&zu=7FwzEAfFqVXFKCCA/DI0OQ==&zt=M2lKeA/v0pQSfsBopEFMMQ=='}
    }).then(res => res)
  }
}

export function getUserInfo () {
  return request({
    method:'get',
    url: 'api/member/api-member/member/getUserInfo'
  }).then(res => res.data)
}


export function getNativePlaces () {
  // return request('get', `/api-admin/job/getNativeplace`)
  return request('get', `/job/getNativeplace`)
}

export function getEmployeeById (id) {
  // return request('get', `/api-admin/member/getEmployeeById/${id}`)
  return request('get', `/member/getEmployeeById/${id}`)
}

export function updateMainInfo (data) {
  // return request('post', `/api-admin/member/updateMainInfo`, data)
  return request('post', `/member/updateMainInfo`, data)
}

export function addEducationInfo (data) {
  // return request('post', `/api-admin/member/saveEducationInfo`, data)
  return request('post', `/member/saveEducationInfo`, data)
}

export function updateEducationInfo (data) {
  // return request('post', `/api-admin/member/updateEducationInfo`, data)
  return request('post', `/member/updateEducationInfo`, data)
}

export function deleteEducationInfo (oid) {
  // return request('post', `/api-admin/member/deleteEducation/${data.oid}`)
  return request('get', `/member/deleteEducation/${oid}`)
}

export function addSocietyInfo (data) {
  // return request('post', `/api-admin/member/saveSociety`, data)
  return request('post', `/member/saveSociety`, data)
}

export function updateSocietyInfo (data) {
  // return request('post', `/api-admin/member/updateSociety`, data)
  return request('post', `/member/updateSociety`, data)
}

export function deleteSocietyInfo (oid) {
  // return request('post', `/api-admin/member/deleteSociety/${oid}`)
  return request('get', `/member/deleteSociety/${oid}`)
}

export function addFamilyInfo (data) {
  // return request('post', `/api-admin/member/saveFamily`, data)
  return request('post', `/member/saveFamily`, data)
}

export function updateFamilyInfo (data) {
  // return request('post', `/api-admin/member/updateFamily`, data)
  return request('post', `/member/updateFamily`, data)
}

export function deleteFamilyInfo (oid) {
  // return request('post', `/api-admin/member/deleteFamily/${oid}`)
  return request('get', `/member/deleteFamily/${oid}`)
}

export function addInorgInfo (data) {
  // return request('post', `/api-admin/member/saveInorgInfo`, data)
  return request('post', `/member/saveInorgInfo`, data)
}

export function updateInorgInfo (data) {
  // return request('post', `/api-admin/member/updateInorgInfo`, data)
  return request('post', `/member/updateInorgInfo`, data)
}

export function deleteInOrgInfo (oid) {
  // return request('post', `/api-admin/member/deleteInorg/${oid}`)
  return request('get', `/member/deleteInorg/${oid}`)
}

export { login }
